package com.alibaba.nls.client;

public class CallExe {
    public static void main(String[] args) {
        new CallExe().startApplication("打开临沂站");
    }


    public void startApplication(String name) {
        Runtime rt = Runtime.getRuntime();
        Process p = null;
        String fileLac = "";
        try {
//            fileLac = "D:\\Program Files (x86)\\Notepad++\\notepad++.exe";// 要调用的程序路径
//            p = rt.exec(fileLac);
            if (name.contains("打开云平台")) {
                if (OSinfo.isMacOSX()) {
                    rt.exec("open http://linyi.sgdangjian.qs110.com/");
                }

                if (OSinfo.isWindows()) {
                    rt.exec("Start Chrome http://linyi.sgdangjian.qs110.com/");
                }
            }

            if (name.contains("关闭云平台")) {
                if (OSinfo.isMacOSX()) {
                    rt.exec("osascript -e 'tell application \"Chrome\" to close last window'");
                }

                if (OSinfo.isWindows()) {
                    rt.exec("taskkill /IM chrome.exe");
                }
            }
        } catch (Exception e) {
            System.out.println("open failure");
        }

    }
}
